package com.bjqh.edu.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/10/18.
 */

public class Send3Adapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> datas;//因为要用将fragment加入到viewpager之中,所以内容为fragment类型的集合

    String title1 = "待上课程";
    String title2 = "完成课程";
    String [] titles = {title1,title2};//设置底部tablayoutout显示文字
    public Send3Adapter(FragmentManager fm, ArrayList<Fragment> datas) {
        super(fm);
        this.datas = datas;
    }

    @Override
    public Fragment getItem(int position) {
        return datas.get(position);
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override//tablayout和viewpager结合之后,创建底部title使用的方法
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
